import { createRouter,createWebHashHistory } from 'vue-router'

import home from '@/views/home/index.vue'                                                     //首页
import mainPage from '@/views/mainPage/index.vue'
import detailPages from '@/views/detailPages/index.vue'                                       //详情页
import lastPage from '@/views/lastPage/index.vue'                                             //尾页
import scientificAchievements from '@/views/detailPages/children/scientificAchievements.vue'  //科学成就
import scientist from '@/views/detailPages/children/scientist.vue'                            //科学家
import scientificWorks from '@/views/detailPages/children/scientificWorks.vue'                //科学著作
import excellentCulture from '@/views/detailPages/children/excellentCulture.vue'              //优秀文化



const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',                                        //首页
      name: 'home',
      component: home,
      meta: {
        transition: 'home' // 首页专属动画
      }
    },

    {
      path: '/mainPage',                                //主页面
      name: 'mainPage',
      component: mainPage,
    },

    {
      path: '/detailPages',                             //详情页
      name: 'detailPages',
      component: detailPages,
      redirect: '/detailPages/scientificAchievements',
      children:[
        {
          path: '/detailPages/scientificAchievements',  //科学成就
          name: 'scientificAchievements',
          component: scientificAchievements,
        },

        {
          path: '/detailPages/scientist',               //科学家
          name: 'scientist',
          component: scientist,
        },

        {
          path: '/detailPages/scientificWorks',         //科学著作
          name: 'scientificWorks',
          component: scientificWorks,
        },

        {
          path: '/detailPages/excellentCulture',        //优秀文化
          name: 'excellentCulture',
          component: excellentCulture,
        },
      ]
    },

    {
      path: '/lastPage',                                //尾页
      name: 'lastPage',
      component: lastPage,
    },
  ],
})



export default router
